﻿using Common;
using Common.XmlHandle;
using Network.UpdateData;
using System.Net.Sockets;
using System.Threading;

namespace SFJDManagement.SocketHandle
{
    /// <summary>
    /// 接收到服务端返回的划号信息
    /// </summary>
    class SC01RegisterDataReply : PacketHandle
    {
        public SC01RegisterDataReply(Socket socket, Packet packet) : base(socket, packet)
        {
        }

        protected override void Handle()
        {
            Thread thread = new Thread(ShowInfo);
            thread.SetApartmentState(ApartmentState.STA);
            thread.Start();
            //Thread.CurrentThread.SetApartmentState(ApartmentState.STA);
            //Thread.CurrentThread.IsBackground = true;
        }

        private void ShowInfo()
        {
            ClassData data = new ClassData();
            data.DecodingFromString(Message);
            //string[] st = Message.Split('♠');
            //new Win_Number(st[0], st[1]).Show();
            new Win_Number(data.Code, data.ID.ToString()).Show();
            Runtime.xmlTemp.RemoveDataCache(data);
            System.Windows.Threading.Dispatcher.Run();
        }
    }
}
